# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 15:38
# @Author  : qd
# @Email   : 1518603573@qq.com
# @File    : fiance_yfk_add_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from selenium.webdriver.common.by import By
"""添加应付款界面"""
class YfkAddPage(BasePage):
    url="/crm/index.php?m=finance&a=add&t=payables"
    """应付款名输入框定位器"""
    yfk_input_name_locator = (By.ID, "name")
    """客户名输入框定位器"""
    yfk_input_customer_locator = (By.ID, "customer")
    """选择客户定位器"""
    yfk_btn_customer_locator = (By.CSS_SELECTOR, "#datas > tr > td:nth-child(1) > input[type=radio]:nth-child(1)")
    """ok按钮定位器"""
    yfk_btn_ok_locator = (By.CSS_SELECTOR,"body > div:nth-child(8) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)")
    """负责人输入框定位器"""
    yfk_input_owner_locator = (By.ID, "owner_name")
    """金额输入框定位器"""
    yfk_input_price_locator = (By.ID, "price")
    """保存按钮定位器"""
    yfk_btn_submit_locator = (By.CSS_SELECTOR,"body > div.container > div.row > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(1)")

    """输入应付款名"""
    def input_yfk_name(self,yfk_name):
        self.driver.find_element(*self.yfk_input_name_locator).send_keys(yfk_name)

    """点击客户输入框"""
    def click_yfk_input_customer(self):
        self.driver.find_element(*self.yfk_input_customer_locator).click()

    """选择客户"""
    def click_yfk_btn_customer(self):
        self.driver.find_element(*self.yfk_btn_customer_locator).click()

    """点击ok"""
    def click_yfk_btn_ok(self):
        self.driver.find_element(*self.yfk_btn_ok_locator).click()

    """输入应付款金额"""
    def input_yfk_price(self,yfk_price):
        self.driver.find_element(*self.yfk_input_price_locator).send_keys(yfk_price)

    """点击保存"""
    def click_yfk_btn_submit(self):
        self.driver.find_element(*self.yfk_btn_submit_locator).click()
